/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import interfaces.InternationalizableEntity;
import interfaces.InternationalizableEntityDescription;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author damfercer
 */
@Entity
@Table(name = "job_duration_description")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "JobDurationDescription.findAll", query = "SELECT j FROM JobDurationDescription j"),
    @NamedQuery(name = "JobDurationDescription.findByIdJobDurationDescription", query = "SELECT j FROM JobDurationDescription j WHERE j.idJobDurationDescription = :idJobDurationDescription"),
    @NamedQuery(name = "JobDurationDescription.findByDescription", query = "SELECT j FROM JobDurationDescription j WHERE j.description = :description")})
public class JobDurationDescription implements Serializable,InternationalizableEntityDescription {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_JOB_DURATION_DESCRIPTION")
    private Integer idJobDurationDescription;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "DESCRIPTION")
    private String description;
    @JoinColumn(name = "JOB_DURATION", referencedColumnName = "ID_JOB_DURATION")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private JobDuration jobDuration;
    @JoinColumn(name = "LANGUAGE", referencedColumnName = "ID_LANGUAGE")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Language language;

    public JobDurationDescription() {
    }

    public JobDurationDescription(Integer idJobDurationDescription) {
        this.idJobDurationDescription = idJobDurationDescription;
    }

    public JobDurationDescription(Integer idJobDurationDescription, String description) {
        this.idJobDurationDescription = idJobDurationDescription;
        this.description = description;
    }

    public Integer getIdJobDurationDescription() {
        return idJobDurationDescription;
    }

    public void setIdJobDurationDescription(Integer idJobDurationDescription) {
        this.idJobDurationDescription = idJobDurationDescription;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public JobDuration getJobDuration() {
        return jobDuration;
    }

    public void setJobDuration(JobDuration jobDuration) {
        this.jobDuration = jobDuration;
    }

    public Language getLanguage() {
        return language;
    }

    public void setLanguage(Language language) {
        this.language = language;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idJobDurationDescription != null ? idJobDurationDescription.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JobDurationDescription)) {
            return false;
        }
        JobDurationDescription other = (JobDurationDescription) object;
        if ((this.idJobDurationDescription == null && other.idJobDurationDescription != null) || (this.idJobDurationDescription != null && !this.idJobDurationDescription.equals(other.idJobDurationDescription))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.JobDurationDescription[ idJobDurationDescription=" + idJobDurationDescription + " ]";
    }

    @Override
    public InternationalizableEntity getEntity() {
        return getJobDuration();
    }
    
}
